package per.qiao.simplerest.components.actuator;

import org.springframework.http.HttpMethod;
import org.springframework.web.client.HttpMessageConverterExtractor;
import org.springframework.web.client.RequestCallback;
import org.springframework.web.client.RestClientException;
import org.springframework.web.method.support.InvocableHandlerMethod;
import per.qiao.simplerest.components.Actuator;
import per.qiao.simplerest.components.RemoteComponets;
import per.qiao.simplerest.restenum.RestMethod;
import per.qiao.simplerest.restresolver.RestInvokerMethod;

/**
 * Company: 上海数惠系统技术有限公司
 * Department: 数据中心
 * Date: 2020-05-31 10:34
 *
 * @Author: qyp
 * Email: qiaoyp@dist.com.cn
 * Desc: 请求方法执行器
 */
public class RestTemplateActuator implements Actuator {

    private RemoteComponets remoteComponets;

    public RestTemplateActuator(RemoteComponets remoteComponets) {
        this.remoteComponets = remoteComponets;
    }


    /**
     * {@inheritDoc}
     *
     * @param restInvokerMethod
     * @return
     */
    @Override
    public Object execute(RestInvokerMethod restInvokerMethod) {

        Object invoke = remoteComponets.invoke(restInvokerMethod);

        return invoke;
    }
}
